package com.example.demo.message;

import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.CountDownLatch;

/**
 * Created by jinmingjiang on 2017/9/18.
 */
@Log4j2
public class Receiver {
    private CountDownLatch latch;

    @Autowired
    public Receiver (CountDownLatch latch){
        this.latch = latch;
    }

    public void receiveMessage(String message){
        log.info("Received <"+message+">");
        latch.countDown();
    }
}
